
const format = (dateStr) => {
  const date = getDate(dateStr)
  
  const hour = date.getHours()
  // TODO:
  // 前段控件少传了8个小时，导致前后端时间有差距
  // 要么后端减，要么前段加
  // date.setHours(hour + 8)
  return `${date.getFullYear() % 100}/${date.getMonth()+1}/${date.getDate()} `
}

const format1 = (dateStr) => {
  const date = getDate(dateStr)
  
  const hour = date.getHours()

  return `${date.getFullYear() % 100}/${date.getMonth()+1}/${date.getDate()} ${date.getHours() < 10? '0' + date.getHours() : date.getHours()}`
}
const jsonparse = (dateStr) => {
  const data= JSON.parse(dateStr)
  return data
}

const StrToArray = (string) => {
  const Array = (typeof string=== 'string' && string === '[]') ? [] : JSON.parse(string);
  return Array
}


const sumTime = (start, end) => {
  return (Math.round(((getDate(end) - getDate(start)) / 24 / 60 / 60 / 1000) * 100) / 100).toFixed(2)
}
const IsEmpty = (dateStr) => {
  const Flag= isEmpty(dateStr)
  return Flag
}


export default {
  format,
  format1,
  sumTime,
  jsonparse,
  StrToArray,
  IsEmpty
}